package com.me.dogdog.util


/**
 * @author 18721
 */

class Result<T> {
    private var status: Int
    private var message: String
    private var data: T

    constructor(status: Int, message: String, data: T) {
        this.status = status
        this.message = message
        this.data = data
    }

    constructor(data: T) {
        status = 200
        message = "OK"
        this@Result.data = data
    }

    companion object {
        fun build(status: Int, msg: String, data: Any): Result<*> {
            return Result(status, msg, data)
        }

        fun ok(data: Any): Result<*> {
            return Result(data)
        }

        fun ok(): Result<*> {
            return Result<Any?>(null)
        }
    }
}